﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.MarketModel
{
    public partial class MMarketitemBuy : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.新增 };
            }
        }
        protected override string DWZRef
        {
            get { return "MMarketitemList"; }
        }

        protected int MMID
        {
            get
            {
                return GetRequestValue<int>("MMID", 0);
            }
        }

        protected MMarketItemInfo _obj = null;
        protected MMarketItemInfo obj
        {
            get
            {
                if (_obj == null)
                {
                    _obj = MMarketItemController.GetByMMID(MMID);
                }
                return _obj;
            }
        }

        #region

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "buy")
            {
                addmenu();
                
            }
        }

        protected void addmenu()
        {
            MbuyDetailInfo obj2 = Request.SerializableObject<MbuyDetailInfo>();

            //  obj2.AddRealName = User.RealName;

            this.AddLog(Permission.新增, "", obj2);
            if (MMarketItemController.MbuyDetail_Add(obj2) > 0)
                SuccessJson("入库成功", "");
            else
                ErrorJson("入库失败", "");
        }
    }
}